package com.imooc.framework.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class FilerOddDemo {

    public static void main(String[] args) {
//        List<Integer> list = new ArrayList<>();
//        for (int i = 0; i < 10; i++) {
//            list.add(i);
//        }
//        Stream<Integer> stream = list.stream();
//
//        stream =  stream.filter(n ->
//              n % 2 == 1
//        );
//
//        List<Integer> result = stream.collect(Collectors.toList());
//
//        result.forEach(System.out::print);

        List<Employee> list = Employee.getEmpList();
        Stream<Employee> stream = list.parallelStream();
        stream = stream.filter(people -> people.getAge() >=30);
        List<Employee> result = stream.collect(Collectors.toList());
        result.forEach(System.out::println);
    }
}
